﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="Consult.aspx.cs" Theme="Default" MasterPageFile="~/Design.Master" Inherits="Resto55Business_WebRole.Consult" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            text-align: left;
            
        }
        .style2
        {
            text-align: right;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
    <div style="height:40px"><asp:Label ID="L_Name" runat="server" onload="L_Name_Load" ForeColor="#ffffff" Font-Bold="True"></asp:Label></div>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
               <ContentTemplate>
                   <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                   <ProgressTemplate>Chargement en cours</ProgressTemplate>
                   </asp:UpdateProgress>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="ObjectDataSource1" GridLines="None" SkinID="GridViewZeCloud" Width="320px">
            <Columns>
            <asp:BoundField DataField="categorie" HeaderText="categorie" 
                    SortExpression="categorie" Visible="false"  />
                <asp:TemplateField HeaderText="titre" SortExpression="title">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("title") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                       
                        
                       <%# Eval("title") %>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:BoundField DataField="description" HeaderText="description" 
                    SortExpression="description" />
                
                <asp:BoundField DataField="Timestamp" HeaderText="Timestamp" 
                    SortExpression="Timestamp" Visible="false" />
                <asp:BoundField DataField="PartitionKey" HeaderText="PartitionKey" 
                    SortExpression="PartitionKey" Visible="false"  />
                <asp:BoundField DataField="RowKey" HeaderText="RowKey" 
                    SortExpression="RowKey"  Visible="false" />
                 <asp:TemplateField HeaderText="Prix" >
                 <ItemTemplate>
                     <asp:HyperLink ID="Hl_Price" runat="server">
                     <asp:Label ID="Label2" runat="server" Text="Pas encore de prix" 
                         ondatabinding="Label2_DataBinding"></asp:Label>
                         </asp:HyperLink><br />
                  <asp:LinkButton ID="Link_add" runat="server" 
                              Text=" ajouter un prix " onclick="Link_add_Click" >
                            </asp:LinkButton>
                     <asp:Panel ID="P_AddPrice" runat="server" Visible="False">
                       
                       <asp:HiddenField ID="HF_ElId"  runat="server" 
                             Value='<%# Eval("PartitionKey") + "_" + Eval("RowKey") %>' />
                         Ancien Prix<br />    
                         <asp:TextBox ID="TB_oldPrice" MaxLength="10"  Columns="3" runat="server"></asp:TextBox>
                           <asp:CompareValidator ID="CompareValidator1" runat="server" 
                             ControlToValidate="TB_oldPrice" Display="Dynamic" ErrorMessage="Prix incorrect" 
                             Operator="DataTypeCheck" Type="Double" ValidationGroup="AddPr"></asp:CompareValidator>
                         <br />
                         Nouveau Prix<br />    
                         <asp:TextBox ID="TB_Price2" MaxLength="10"  Columns="3" runat="server"></asp:TextBox>
                         <asp:Button ID="Bt_SavePr"  runat="server" ValidationGroup="AddPr" Text="Enregistrer" 
                             onclick="Bt_SavePr_Click" />
                        <asp:LinkButton ID="Bt_CancelPr" runat="server" onclick="Bt_CancelPr_Click" >Annuler</asp:LinkButton>
                         <asp:CompareValidator ID="CompareValidator2" runat="server" 
                             ControlToValidate="TB_Price2" Display="Dynamic" ErrorMessage="Prix incorrect" 
                             Operator="DataTypeCheck" Type="Double" ValidationGroup="AddPr"></asp:CompareValidator>
                         <asp:RequiredFieldValidator ID="RFV_Price" runat="server" ValidationGroup="AddPr" ControlToValidate="TB_Price2" ErrorMessage="Prix obligatoire" Display="Dynamic"></asp:RequiredFieldValidator>
                     </asp:Panel>
            
                 </ItemTemplate>
                 </asp:TemplateField>
                
            </Columns>
        
        </asp:GridView>

        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="GetElementsToDisplay" 
            TypeName="Resto55Business_WebRole.ElementsToDisplay">
            <SelectParameters>
                <asp:QueryStringParameter Name="restoid" QueryStringField="id" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
                </ContentTemplate>
               </asp:UpdatePanel>
        
    
    <div>
     <asp:LinkButton ID="HlAddE" runat="server" onclick="HlAddE_Click" >Ajouter un Element</asp:LinkButton>
        <asp:Panel ID="PAddE" runat="server" Visible="False">
            <table style="width:100%;">
                <tr>
                    <td class="style2">
                        <asp:Label ID="L_El" runat="server" Text="Nom :"></asp:Label>
                    </td>
                    <td class="style1">
                        <asp:TextBox ID="T_El" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="T_El" Display="Dynamic" ValidationGroup="AddE" ErrorMessage="Champ requis"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        <asp:Label ID="L_Cat" runat="server" Text="Catégorie :"></asp:Label>
                    </td>
                    <td class="style1">
                        <asp:TextBox ID="T_Cat" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        <asp:Label ID="L_Descr" runat="server" Text="Description :"></asp:Label>
                    </td>
                    <td class="style1">
                        <asp:TextBox ID="T_Descr" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                <td class="style2">
                        <asp:Label ID="Label3" runat="server" Text="Ancien prix :"></asp:Label>
                    </td>
                    <td class="style1">
                       <asp:TextBox ID="TB_oldPrice2" MaxLength="10"  Columns="3" runat="server" ValidationGroup="AddE"></asp:TextBox>
                        <asp:CompareValidator ID="CompareValidator3" runat="server" ControlToValidate="TB_oldPrice2"
                            Display="Dynamic" ErrorMessage="Prix incorrect" Operator="DataTypeCheck" ValidationGroup="AddE" Type="Double"></asp:CompareValidator><br />
                 
                </td>
                </tr>
                <tr>
                    <td class="style2">
                        <asp:Label ID="L_Prix" runat="server" Text="Nouveau prix :"></asp:Label>
                    </td>
                    <td class="style1">
                        <asp:TextBox ID="Tb_Price" MaxLength="10" Columns="3" runat="server" ValidationGroup="AddE"></asp:TextBox>
                        <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="Tb_Price"
                            Display="Dynamic" ErrorMessage="Prix incorrect" Operator="DataTypeCheck" Type="Double" ValidationGroup="AddE"></asp:CompareValidator>
                    <asp:RequiredFieldValidator ID="RFV_Price2" runat="server" ControlToValidate="Tb_Price"  ValidationGroup="AddE" ErrorMessage="Prix actuel obligatoire" Display="Dynamic"></asp:RequiredFieldValidator>
                </td>
                </tr>
            </table>
            <asp:Button ID="Bt_Add" runat="server" Text="Ajouter" onclick="Bt_Add_Click" ValidationGroup="AddE"/>
            <asp:LinkButton ID="Bt_Cancel" runat="server" onclick="Bt_Cancel_Click" >Annuler</asp:LinkButton>
        </asp:Panel>
    </div>
</asp:Content>
